<%@page import="java.util.ArrayList"%>
<%@page import="custom.Announcement"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add/Edit Announcements</title>
</head>
<body>

	<%@ include file="header.jsp" %>
	<center><div style="width: 800px;" align="left">
		<%if ( !( (User)session.getAttribute("user") ).areYouAdmin() ) {%>
				You have no right to visit this page
		<%}else{%>
				<p align="center"> Add / Edit Announcements</p>
				
				<form action="addOrRemoveAnnouncementServlet" method="post">
					<input type="hidden" name="addOrRemove" value="add"/>
					<input type="hidden" name="idToRemove" value="-1"/>
					<input type="text" name="newAnnouncement" value=""/>
					<input type="submit" value="add" />
				</form>
				<p></p>
		<%
				ArrayList<Announcement> ano = Announcement.getLastNAnnouncements(-1);
				for(int i=ano.size()-1; i> -1; i--){
					out.print(ano.get(i).getJsp());
				}
				if(ano.size()==0)
					out.print("No Announcements");
		}%>
	</div></center>
</body>
</html>